package com.yj.auto.core.web.common.controller;

import java.util.ArrayList;
import java.util.List;

import com.jfinal.core.ActionKey;
import com.jfinal.kit.StrKit;
import com.jfinal.log.Log;
import com.yj.auto.Constants;
import com.yj.auto.core.jfinal.base.BaseController;
import com.yj.auto.core.web.system.model.Org;
import com.yj.auto.core.web.system.service.OrgService;
import com.yj.auto.helper.AutoHelper;
import com.yj.auto.plugin.ztree.ZTreeNode;

/**
 * 
 */
public class SelectController extends BaseController {
	private static Log logger = Log.getLog(SelectController.class);

//	public void org() {
//		OrgService orgSrv = AutoHelper.getOrgService();
//		Integer id = getParaToInt("id");
//		List<Org> list = orgSrv.children(id, Constants.DATA_STATE_VALID);
//		List<ZTreeNode> result = new ArrayList<ZTreeNode>();
//		for (Org c : list) {
//			List<Org> subs = orgSrv.children(c.getId(), Constants.DATA_STATE_VALID);
//			ZTreeNode t = getZTreeNode(c, subs.size() > 0);
//			if (null == id && t.getIsParent()) {
//				t.setOpen(true);
//				for (Org s : subs) {
//					t.addChildren(getZTreeNode(s, orgSrv.children(s.getId(), Constants.DATA_STATE_VALID).size() > 0));
//				}
//			}
//			result.add(t);
//
//		}
//		renderJson(result);
//
//	}
//
//	private ZTreeNode getZTreeNode(Org c, boolean parent) {
//		ZTreeNode t = new ZTreeNode(c.getId().toString(), c.getName());
//		t.setIsParent(parent);
//		t.addAttribute("type", c.getType());
//		return t;
//	}

}